/**
 * Created by 小敏哥 on 2017/10/23.
 */
import React, {Component} from 'react';
import style from './index.scss';

class UserGuide extends Component {
    constructor(props) {
        super(props);
        this.state = {
            step: 0,
            mainClass: style.hide
        }
    }

    componentDidMount() {
        if (localStorage.getItem('hasShowInspectionGuide') == null) {
            this.setState({
                mainClass: style.container
            });
            localStorage.setItem('hasShowInspectionGuide', 'true');
        }
    }


    //引导动作
    guide() {
        if (this.state.step == 0) {
            this.setState({
                    step: 1
                }
            )
        }
        else {
            this.setState({
                mainClass: style.hide
            })
        }
    }

    render() {
        return <div className={this.state.mainClass}>
            <img className={this.state.step == 0 ? '' : style.hide} src={this.props.img1}/>
            <img className={this.state.step == 1 ? '' : style.hide} src={this.props.img2}/>
            <button onClick={() => {
                this.guide()
            }}>我知道了
            </button>
        </div>
    }
}

export default UserGuide